package com.mt.channel.service.impl;

import java.util.List;
import java.util.Map;


import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.mt.channel.api.service.IChannelAccountLogService;
import com.mt.channel.entity.ChannelAccountLogEntity;
import com.mt.channel.service.model.ChannelAccountLogServiceModel;
import com.mt.common.PagerInfo;
import com.mt.common.ServiceResult;
import com.mt.common.constants.BaseErrorConstants;
import org.springframework.stereotype.Service;

@Service
public class ChannelAccountLogServiceImpl implements IChannelAccountLogService {

    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ChannelAccountLogServiceImpl.class);

    @Autowired
    private ChannelAccountLogServiceModel channelAccountLogServiceModel;

    public ServiceResult<ChannelAccountLogEntity> findInfo(Map<String, Object> params) {
        ServiceResult<ChannelAccountLogEntity> result = null;
        try {
            result = channelAccountLogServiceModel.selectInfo(params);
        } catch (Exception e) {
            LOGGER.error("[ChannelAccountLogServiceImpl][findInfo]：query findInfo occur exception", e);
            result.setError(BaseErrorConstants.ERROR_CODE_SERVICE_CONTROLLER, "查询详情错误");
        }
        return result;
    }

    public ServiceResult<List<ChannelAccountLogEntity>> findList(Map<String, Object> params, PagerInfo<?> pagerInfo) {
        ServiceResult<List<ChannelAccountLogEntity>> result = new ServiceResult<List<ChannelAccountLogEntity>>();
        try {
            result = channelAccountLogServiceModel.selectList(params, pagerInfo);
        } catch (Exception e) {
            LOGGER.error("[ChannelAccountLogServiceImpl][findList]：query findList occur exception", e);
            result.setError(BaseErrorConstants.ERROR_CODE_SERVICE_CONTROLLER, "查询列表错误");
        }
        return result;
    }

    public ServiceResult<ChannelAccountLogEntity> findAmounts(Map<String, Object> params) {
        ServiceResult<ChannelAccountLogEntity> result = null;
        try {
            result = channelAccountLogServiceModel.selectAmounts(params);
        } catch (Exception e) {
            LOGGER.error("[ChannelAccountLogServiceImpl][selectAmounts]：query selectAmounts occur exception", e);
            result.setError(BaseErrorConstants.ERROR_CODE_SERVICE_CONTROLLER, "查询各汇总金额错误");
        }
        return result;
    }
}